import 'package:flutter/material.dart';
import 'package:untitled/pages/home/tab_mine/function_button_data.dart';
import 'package:untitled/widgets/common_image.dart';

class FunctionButtonWidget extends StatelessWidget {
  final FunctionButtonItem functionButtonItem;

  const FunctionButtonWidget(this.functionButtonItem,{Key key}) : super(key: key);


  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: (){
        print("haha");
        if(null != functionButtonItem.onTapHandle){

          functionButtonItem.onTapHandle(context);
        }

      },
      child:  Container(
        margin: EdgeInsets.only(top: 20.0),
        //宽度为屏幕的0.33倍
        width: MediaQuery.of(context).size.width*0.33,
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            CommonImage(src: functionButtonItem.imageUrl,width: 50.0,),
            Text(functionButtonItem.title)
          ],
        ),
      ),
    );

  }
}
